package cosc617_blackteam;

import java.util.ArrayList;


	/**
	 * An iterator that iterates through all the items in the given menu
	 * @author Laura Semesky
	 */
	public class DefaultMenuIterator implements I_MenuIterator {

		ArrayList<MenuItem> menu;
		private int index; //index of current Item
		
		public DefaultMenuIterator(ArrayList<MenuItem> menu){
			index = 0;
			this.menu = menu;	
		}
		
		
		@Override
		public boolean hasNext() {
			//no criteria to filter menu so same as traversing the array
			return index < menu.size() ;
		}

		@Override
		public MenuItem next() {
			MenuItem output;
			if(hasNext())
				output = menu.get(index);
			else output = null;
			index++;
			return output;
		}


		@Override
		public void remove() {
			throw new UnsupportedOperationException();
			
		}

	}

